<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@include file="/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<fmt:bundle basename="res">
<head>
    <meta charset="utf-8">
    <title><fmt:message key='ttblsjxt'/></title>
    <jsp:include page="/WEB-INF/commons/commons-header.jsp" flush="true"/>
    <style>
        html {
            background: #fff;
        }
    </style>
</head>

<body>
<div class="layui-container">
    <div lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">

        <form:form class="layui-form" commandName="goods" method="${_method }" id="form">
            <input type="hidden" name="_method" value="${_method }"/>
            <form:hidden path="id"/>

            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                <legend><fmt:message key='jbxx'/></legend>
            </fieldset>

            <div class="layui-form-item goodsChannelArea">
                <label class="layui-form-label"><fmt:message key='splm'/></label>

                <div class="layui-form-mid layui-word-aux">
                        ${goods.goodsChannel.parent.parent.name} >> ${goods.goodsChannel.parent.name} >> ${goods.goodsChannel.name}
                </div>

            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"><fmt:message key='spmc'/></label>
                <div class="layui-form-mid layui-word-aux">
                        ${goods.name}
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"><fmt:message key='spbh'/></label>
                <div class="layui-form-mid layui-word-aux">
                        ${goods.goodsNo}
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"><fmt:message key='spjg'/></label>
                <div class="layui-form-mid layui-word-aux">
                    <fmt:formatNumber value="${goods.defaultPrice}" type="CURRENCY"/>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"><fmt:message key='scj'/></label>
                <div class="layui-form-mid layui-word-aux">
                    <fmt:formatNumber value="${goods.marketPrice}" type="CURRENCY"/>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"><fmt:message key='tjhdjg'/></label>
                <div class="layui-form-mid layui-word-aux">
                    <fmt:formatNumber value="${goods.bargainPrice}" type="CURRENCY"/>
                </div>
            </div>

            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                <legend><fmt:message key='spgg'/></legend>
            </fieldset>

            <div class="layui-form-item">
                <label class="layui-form-label"><fmt:message key='spsku'/></label>
                <div class="layui-input-block">
                    <table class="layui-table" lay-size="sm" id="feijin-sku-table">
                        <thead>
                        <tr>
                            <th><fmt:message key='gg'/></th>
                            <th><fmt:message key='sjbh'/></th>
                            <th><fmt:message key='kcs'/></th>
                            <th><fmt:message key='xsj'/></th>
                            <th><fmt:message key='hdkc'/></th>
                            <th><fmt:message key='tj1'/></th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${goods.skus}" var="sku">
                            <tr>
                                <td>${sku.skuNames}</td>
                                <td>${sku.code}</td>
                                <td>${sku.store}</td>
                                <td><fmt:formatNumber value="${sku.price}" type="CURRENCY"/></td>
                                <td>${sku.bargainStore}</td>
                                <td><fmt:formatNumber value="${sku.bargainPrice}" type="CURRENCY"/></td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </div>
            </div>

            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
                <legend><fmt:message key='shxx'/></legend>
            </fieldset>

            <div class="layui-form-item">
                <label class="layui-form-label"><fmt:message key='shzt'/></label>
                <div class="layui-form-mid layui-word-aux">
                    <c:choose>
                        <c:when test="${goods.bargainStatus eq 2}"><fmt:message key='shz'/></c:when>
                        <c:when test="${goods.bargainStatus eq 3}"><fmt:message key='shtg'/></c:when>
                        <c:when test="${goods.bargainStatus eq 4}"><fmt:message key='shbtg'/></c:when>
                    </c:choose>
                </div>
            </div>


            <div class="layui-form-item">
                <label class="layui-form-label"><b style="color:red">*</b> <fmt:message key='shjg'/></label>
                <div class="layui-input-inline" style="width:70%;">
                    <input type="radio" name="bargainStatus" lay-filter="bargainStatus" lay-verify="required" value="3" title="<fmt:message key='shtg'/>" <c:if test="${goods.bargainStatus eq 3}">checked="checked"</c:if>/>
                        <%--<input type="radio" name="bargainStatus" lay-filter="bargainStatus" lay-verify="required" value="5" title="审核通过并开始活动（开发使用）" <c:if test="${goods.bargainStatus eq 5}">checked="checked"</c:if>/>--%>
                    <input type="radio" name="bargainStatus" lay-filter="bargainStatus" lay-verify="required" value="4" title="<fmt:message key='shbtg'/>" <c:if test="${goods.bargainStatus eq 4}">checked="checked"</c:if>/>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"><fmt:message key='shbz'/></label>
                <div class="layui-input-inline" style="width:80%;">
                    <form:textarea path="checkNote" class="layui-textarea" style="height:100px;width:100%"/>
                </div>
            </div>

            <div class="layui-input-block">
                <div style="display: none"><input type="button" value="<fmt:message key='bc'/>" class="layui-btn" id="submit" lay-filter="submit" lay-submit></div>
            </div>

        </form:form>
    </div>
</div>

<script>

    $(function () {

        layui.use(['form', 'laydate'], function () {

            var form = layui.form;
            var laydate = layui.laydate;

            form.on('submit(submit)', function (data) {


                var mainType = $(":radio[name='bargainStatus']:checked").val();

                if (!mainType) {
                    layui.use('layer', function () {
                        layer.msg("<fmt:message key='qxzshzt'/>");
                    });

                    return false;
                }


                $("#form").ajaxSubmit({
                    success: function (result) {
                        if (result.status) {
                            var index = parent.layer.getFrameIndex(window.name);
                            parent.layer.close(index);
                            parent.$("#search").click();
                        } else {
                            layui.use('layer', function () {
                                layer.msg(result.message);
                            });
                        }
                    }
                });
            });


        });

    });
</script>
</body>
</fmt:bundle>
</html>